package com.xposed.aliproxy.xposed;

import android.content.Context;
import android.content.Intent;

import com.xposed.aliproxy.utils.Utils;
import com.xposed.aliproxy.utils.XposeUtil;

import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
import de.robv.android.xposed.XposedHelpers;

public class AliHookMethode extends XC_MethodHook {
    private Context context;

    public AliHookMethode(Context context) {
        this.context = context;
    }

    @Override
    protected void afterHookedMethod(MethodHookParam methodHookParam) throws Throwable {
        String str = (String) XposedHelpers.findField(methodHookParam.thisObject.getClass(), "g").get(methodHookParam.thisObject);
        String str2 = (String) XposedHelpers.callMethod(XposedHelpers.findField(methodHookParam.thisObject.getClass(), "c").get(methodHookParam.thisObject), "getUbbStr", new Object[0]);
        Object obj = methodHookParam.args[0];
        String str3 = (String) XposedHelpers.findField(obj.getClass(), "qrCodeUrl").get(obj);
        XposeUtil.xposedLog("money->", str);
        XposeUtil.xposedLog("remark->", str2);
        XposeUtil.xposedLog("qrCodeUrl->", str3);
        if (!Utils.isNull(str) && !Utils.isNull(str2) && !Utils.isNull(str3)) {
            Intent intent = new Intent("com.abcd.xpouseali.action.aliqrcode.received");
            intent.putExtra("money", str);
            intent.putExtra("remark", str2);
            intent.putExtra("qrCodeUrl", str3);
            this.context.sendBroadcast(intent);
        }
    }
}
